/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.tordroid.model;

import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;

/**
 *
 * @author Christian Simon
 */
@Root
public class Story {

    @Attribute
    private String titel;
    @Attribute(required = false)
    private String place;
    @Attribute
    private String addDate;
    @Attribute(required = false)
    private int ingameTime;
    @Element(required = false)
    private String story;
    @ElementList(required = false)
    private List<Story> subStories;
    @Attribute
    private boolean isSubStory;
    @Attribute
    private boolean isAtc;

    public Story() {
        this.titel = "new";
        this.addDate = DateFormat.getDateTimeInstance().format(new Date());
        this.story = "";
        this.subStories = new ArrayList<Story>();
        this.isSubStory = false;
        this.isAtc = true;
    }

    public boolean isAtc()
    {
        return this.isAtc;
    }
    
    public void setAtc(boolean value)
    {
        this.isAtc = value;
    }
    
    public boolean isSubStory() {
        return this.isSubStory;
    }

    public void setSubStory(boolean is) {
        this.isSubStory = is;
    }

    public Story(String titel, String story) {
        this();
        this.titel = titel;
        this.story = story;
    }

    /**
     * @return the titel
     */
    public String getTitel() {
        return titel;
    }

    /**
     * @param titel the titel to set
     */
    public void setTitel(String titel) {
        this.titel = titel;
    }

    /**
     * @return the place
     */
    public String getPlace() {
        return place;
    }

    /**
     * @param place the place to set
     */
    public void setPlace(String place) {
        this.place = place;
    }

    /**
     * @return the story
     */
    public String getStory() {
        return story;
    }

    /**
     * @param story the story to set
     */
    public void setStory(String story) {
        this.story = story;
    }

    /**
     * @return the addDate
     */
    public String getAddDate() {
        return addDate;
    }

    /**
     * @return the ingameTime
     */
    public int getIngameTime() {
        return ingameTime;
    }

    /**
     * @param ingameTime the ingameTime to set
     */
    public void setIngameTime(int ingameTime) {
        this.ingameTime = ingameTime;
    }

    /**
     * @return the subStories
     */
    public List<Story> getSubStories() {
        return subStories;
    }

    /**
     * @param subStories the subStories to set
     */
    public void setSubStories(List<Story> subStories) {
        this.subStories = subStories;
    }

    public void addSubStory(Story subStory) {
        this.subStories.add(subStory);
    }

    public Story getSubStory(int position) {
        return this.subStories.get(position);
    }
}
